package Set.hashSet;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.function.Consumer;

public class Test1 {
    public static void main(String[] args) {
        Set<String> s = new HashSet<>();
        boolean r1 = s.add("zhangsan");
        boolean r2 = s.add("san");
        boolean r3 = s.add("123");

        Iterator<String> it = s.iterator();
        while (it.hasNext()) {
            String s1 = it.next();
            System.out.println(s1);
        }

        for (String string : s) {
            System.out.println(string);
        }

        s.forEach(s1 -> System.out.println(s1)
        );
    }
}
